package xkp;

import java.io.IOException;
import java.io.FileInputStream;

public class Main {
    public static void main(String[] args) throws IOException {

        int length = 0;

        FileInputStream fis = new FileInputStream("C:\\Users\\Administrator\\Desktop\\hosts");

        byte[] buf = new byte[16];
        // read till the end of the stream
        while ((length = fis.read(buf)) != -1) {
            // available bytes // From: W Ww .Yi I ba I. C o  m
            int available = fis.available();

            // convert integer to character

            System.out.println("Available: " + available);
            System.out.println("Read: " + new String(buf,0,length));
        }

    }
}